<template>
	<view class="container">
		<uni-forms ref="flowForm" :modelValue="info" class="form" label-width="120px">
			<uni-forms-item label="工单类别">
				<view class="uni-input">{{info.typeName}}</view>
			</uni-forms-item>
			<uni-forms-item label="申请部门" >
				<view class="uni-input">{{info.deptName}}</view>
			</uni-forms-item>
			<uni-forms-item label="申请人" >
				<view class="uni-input">{{info.userName}}</view>
			</uni-forms-item>
			<uni-forms-item label="资产分类" >
				<view class="uni-input">{{info.cateName}}</view>
			</uni-forms-item>
			<uni-forms-item label="采购数量" v-if="info.typeCode == 'purchase'">
				<view class="uni-input">{{info.amount}}</view>
			</uni-forms-item>
			<uni-forms-item label="申请资产" v-if="info.typeCode != 'purchase'">
				<view class="uni-input">{{info.assetNum}}</view>
			</uni-forms-item>
			<uni-forms-item label="单价">
				<view class="uni-input">{{info.price}}</view>
			</uni-forms-item>
			<uni-forms-item label="申请原因">
				<view class="uni-input">{{info.reason}}</view>
			</uni-forms-item
			<uni-forms-item label="申请说明">
				<view class="uni-input">{{info.content}}</view>
			</uni-forms-item>
			<uni-forms-item label="申请申请">
				<view class="uni-input">{{info.applyTime}}</view>
			</uni-forms-item>
			<uni-forms-item label="审核状态">
				<view class="uni-input">{{dictTag('flow_check_status', info.checkStatus)}}</view>
			</uni-forms-item>
			<uni-forms-item label="工单状态">
				<view class="uni-input">{{dictTag('asset_flow_status', info.flowStatus)}}</view>
			</uni-forms-item>				
			<uni-forms-item label="二维码" class="form-item" v-if="info.id">
				<view class="uni-input">
					<image style="width: 200px;" 
					mode="aspectFit" :src="baseUrl +'/asset/qr/flow/'+info.id"></image>
				</view>
			</uni-forms-item>
		</uni-forms>
	</view>
</template>


<script>
	import { getFlow } from '@/api/flow.js'
	import { dictMixin } from '@/plugins/dict.js';
	import config from '@/config'
	export default {
		mixins: [dictMixin],
		data() {
			return {
				// 表单数据
				info: {},
				baseUrl: config.baseUrl
			}
		},
		onLoad() {	
			
			this.useDict(['flow_check_status', 'asset_flow_status']);
				
			getFlow(this.$route.query.id).then(response => {
				this.info = response.data;				
			})	
		},
		methods: {
		}
	}
</script>

<style>
	.form {
		padding: 15px;
		background-color: #fff;
	}
	.button-group {
		margin-top: 15px;
		display: flex;
		justify-content: space-around;
	}

	.form-item {
		display: flex;
		align-items: center;
	}

	.button {
		display: flex;
		align-items: center;
		height: 35px;
		margin-left: 10px;
	}
</style>